
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module apiclient.http</title>
</head><body bgcolor="#f0f0f8">

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="apiclient.html"><font color="#ffffff">apiclient</font></a>.http</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/jcgregorio/projects/apiclient-release/apiclient/http.py">/home/jcgregorio/projects/apiclient-release/apiclient/http.py</a></font></td></tr></table>
    <p><tt>Classes&nbsp;to&nbsp;encapsulate&nbsp;a&nbsp;single&nbsp;HTTP&nbsp;request.<br>
&nbsp;<br>
The&nbsp;classes&nbsp;implement&nbsp;a&nbsp;command&nbsp;pattern,&nbsp;with&nbsp;every<br>
<a href="__builtin__.html#object">object</a>&nbsp;supporting&nbsp;an&nbsp;execute()&nbsp;method&nbsp;that&nbsp;does&nbsp;the<br>
actuall&nbsp;HTTP&nbsp;request.</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
    
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="StringIO.html">StringIO</a><br>
<a href="base64.html">base64</a><br>
<a href="copy.html">copy</a><br>
</td><td width="25%" valign=top><a href="gzip.html">gzip</a><br>
<a href="httplib2.html">httplib2</a><br>
<a href="apiclient.mimeparse.html">apiclient.mimeparse</a><br>
</td><td width="25%" valign=top><a href="mimetypes.html">mimetypes</a><br>
<a href="os.html">os</a><br>
<a href="json.html">json</a><br>
</td><td width="25%" valign=top><a href="urllib.html">urllib</a><br>
<a href="urlparse.html">urlparse</a><br>
<a href="uuid.html">uuid</a><br>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
    
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="apiclient.http.html#BatchHttpRequest">BatchHttpRequest</a>
</font></dt><dt><font face="helvetica, arial"><a href="apiclient.http.html#HttpMock">HttpMock</a>
</font></dt><dt><font face="helvetica, arial"><a href="apiclient.http.html#HttpMockSequence">HttpMockSequence</a>
</font></dt><dt><font face="helvetica, arial"><a href="apiclient.http.html#HttpRequest">HttpRequest</a>
</font></dt><dt><font face="helvetica, arial"><a href="apiclient.http.html#HttpRequestMock">HttpRequestMock</a>
</font></dt><dt><font face="helvetica, arial"><a href="apiclient.http.html#MediaUpload">MediaUpload</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="apiclient.http.html#MediaFileUpload">MediaFileUpload</a>
</font></dt><dt><font face="helvetica, arial"><a href="apiclient.http.html#MediaInMemoryUpload">MediaInMemoryUpload</a>
</font></dt></dl>
</dd>
<dt><font face="helvetica, arial"><a href="apiclient.http.html#MediaUploadProgress">MediaUploadProgress</a>
</font></dt><dt><font face="helvetica, arial"><a href="apiclient.http.html#RequestMockBuilder">RequestMockBuilder</a>
</font></dt></dl>
</dd>
</dl>
 <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="BatchHttpRequest">class <strong>BatchHttpRequest</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Batches&nbsp;multiple&nbsp;<a href="#HttpRequest">HttpRequest</a>&nbsp;objects&nbsp;into&nbsp;a&nbsp;single&nbsp;HTTP&nbsp;request.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="BatchHttpRequest-__init__"><strong>__init__</strong></a>(self, callback<font color="#909090">=None</font>, batch_uri<font color="#909090">=None</font>)</dt><dd><tt>Constructor&nbsp;for&nbsp;a&nbsp;<a href="#BatchHttpRequest">BatchHttpRequest</a>.<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;callback:&nbsp;callable,&nbsp;A&nbsp;callback&nbsp;to&nbsp;be&nbsp;called&nbsp;for&nbsp;each&nbsp;response,&nbsp;of&nbsp;the<br>
&nbsp;&nbsp;&nbsp;&nbsp;form&nbsp;callback(id,&nbsp;response).&nbsp;The&nbsp;first&nbsp;parameter&nbsp;is&nbsp;the&nbsp;request&nbsp;id,&nbsp;and<br>
&nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;second&nbsp;is&nbsp;the&nbsp;deserialized&nbsp;response&nbsp;<a href="__builtin__.html#object">object</a>.<br>
&nbsp;&nbsp;batch_uri:&nbsp;string,&nbsp;URI&nbsp;to&nbsp;send&nbsp;batch&nbsp;requests&nbsp;to.</tt></dd></dl>

<dl><dt><a name="BatchHttpRequest-add"><strong>add</strong></a>(self, request, callback<font color="#909090">=None</font>, request_id<font color="#909090">=None</font>)</dt><dd><tt>Add&nbsp;a&nbsp;new&nbsp;request.<br>
&nbsp;<br>
Every&nbsp;callback&nbsp;added&nbsp;will&nbsp;be&nbsp;paired&nbsp;with&nbsp;a&nbsp;unique&nbsp;id,&nbsp;the&nbsp;request_id.&nbsp;That<br>
unique&nbsp;id&nbsp;will&nbsp;be&nbsp;passed&nbsp;back&nbsp;to&nbsp;the&nbsp;callback&nbsp;when&nbsp;the&nbsp;response&nbsp;comes&nbsp;back<br>
from&nbsp;the&nbsp;server.&nbsp;The&nbsp;default&nbsp;behavior&nbsp;is&nbsp;to&nbsp;have&nbsp;the&nbsp;library&nbsp;generate&nbsp;it's<br>
own&nbsp;unique&nbsp;id.&nbsp;If&nbsp;the&nbsp;caller&nbsp;passes&nbsp;in&nbsp;a&nbsp;request_id&nbsp;then&nbsp;they&nbsp;must&nbsp;ensure<br>
uniqueness&nbsp;for&nbsp;each&nbsp;request_id,&nbsp;and&nbsp;if&nbsp;they&nbsp;are&nbsp;not&nbsp;an&nbsp;exception&nbsp;is<br>
raised.&nbsp;Callers&nbsp;should&nbsp;either&nbsp;supply&nbsp;all&nbsp;request_ids&nbsp;or&nbsp;nevery&nbsp;supply&nbsp;a<br>
request&nbsp;id,&nbsp;to&nbsp;avoid&nbsp;such&nbsp;an&nbsp;error.<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;request:&nbsp;<a href="#HttpRequest">HttpRequest</a>,&nbsp;Request&nbsp;to&nbsp;add&nbsp;to&nbsp;the&nbsp;batch.<br>
&nbsp;&nbsp;callback:&nbsp;callable,&nbsp;A&nbsp;callback&nbsp;to&nbsp;be&nbsp;called&nbsp;for&nbsp;this&nbsp;response,&nbsp;of&nbsp;the<br>
&nbsp;&nbsp;&nbsp;&nbsp;form&nbsp;callback(id,&nbsp;response).&nbsp;The&nbsp;first&nbsp;parameter&nbsp;is&nbsp;the&nbsp;request&nbsp;id,&nbsp;and<br>
&nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;second&nbsp;is&nbsp;the&nbsp;deserialized&nbsp;response&nbsp;<a href="__builtin__.html#object">object</a>.<br>
&nbsp;&nbsp;request_id:&nbsp;string,&nbsp;A&nbsp;unique&nbsp;id&nbsp;for&nbsp;the&nbsp;request.&nbsp;The&nbsp;id&nbsp;will&nbsp;be&nbsp;passed&nbsp;to<br>
&nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;callback&nbsp;with&nbsp;the&nbsp;response.<br>
&nbsp;<br>
Returns:<br>
&nbsp;&nbsp;None<br>
&nbsp;<br>
Raises:<br>
&nbsp;&nbsp;BatchError&nbsp;if&nbsp;a&nbsp;resumable&nbsp;request&nbsp;is&nbsp;added&nbsp;to&nbsp;a&nbsp;batch.<br>
&nbsp;&nbsp;KeyError&nbsp;is&nbsp;the&nbsp;request_id&nbsp;is&nbsp;not&nbsp;unique.</tt></dd></dl>

<dl><dt><a name="BatchHttpRequest-execute"><strong>execute</strong></a>(self, http<font color="#909090">=None</font>)</dt><dd><tt>Execute&nbsp;all&nbsp;the&nbsp;requests&nbsp;as&nbsp;a&nbsp;single&nbsp;batched&nbsp;HTTP&nbsp;request.<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;http:&nbsp;httplib2.Http,&nbsp;an&nbsp;http&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;to&nbsp;be&nbsp;used&nbsp;in&nbsp;place&nbsp;of&nbsp;the&nbsp;one&nbsp;the<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#HttpRequest">HttpRequest</a>&nbsp;request&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;was&nbsp;constructed&nbsp;with.&nbsp;&nbsp;If&nbsp;one&nbsp;isn't&nbsp;supplied<br>
&nbsp;&nbsp;&nbsp;&nbsp;then&nbsp;use&nbsp;a&nbsp;http&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;from&nbsp;the&nbsp;requests&nbsp;in&nbsp;this&nbsp;batch.<br>
&nbsp;<br>
Returns:<br>
&nbsp;&nbsp;None<br>
&nbsp;<br>
Raises:<br>
&nbsp;&nbsp;httplib2.Error&nbsp;if&nbsp;a&nbsp;transport&nbsp;error&nbsp;has&nbsp;occured.<br>
&nbsp;&nbsp;apiclient.errors.BatchError&nbsp;if&nbsp;the&nbsp;response&nbsp;is&nbsp;the&nbsp;wrong&nbsp;format.</tt></dd></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="HttpMock">class <strong>HttpMock</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Mock&nbsp;of&nbsp;httplib2.Http<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="HttpMock-__init__"><strong>__init__</strong></a>(self, filename, headers<font color="#909090">=None</font>)</dt><dd><tt>Args:<br>
&nbsp;&nbsp;filename:&nbsp;string,&nbsp;absolute&nbsp;filename&nbsp;to&nbsp;read&nbsp;response&nbsp;from<br>
&nbsp;&nbsp;headers:&nbsp;dict,&nbsp;header&nbsp;to&nbsp;return&nbsp;with&nbsp;response</tt></dd></dl>

<dl><dt><a name="HttpMock-request"><strong>request</strong></a>(self, uri, method<font color="#909090">='GET'</font>, body<font color="#909090">=None</font>, headers<font color="#909090">=None</font>, redirections<font color="#909090">=1</font>, connection_type<font color="#909090">=None</font>)</dt></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="HttpMockSequence">class <strong>HttpMockSequence</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Mock&nbsp;of&nbsp;httplib2.Http<br>
&nbsp;<br>
Mocks&nbsp;a&nbsp;sequence&nbsp;of&nbsp;calls&nbsp;to&nbsp;request&nbsp;returning&nbsp;different&nbsp;responses&nbsp;for&nbsp;each<br>
call.&nbsp;Create&nbsp;an&nbsp;instance&nbsp;initialized&nbsp;with&nbsp;the&nbsp;desired&nbsp;response&nbsp;headers<br>
and&nbsp;content&nbsp;and&nbsp;then&nbsp;use&nbsp;as&nbsp;if&nbsp;an&nbsp;httplib2.Http&nbsp;instance.<br>
&nbsp;<br>
&nbsp;&nbsp;http&nbsp;=&nbsp;<a href="#HttpMockSequence">HttpMockSequence</a>([<br>
&nbsp;&nbsp;&nbsp;&nbsp;({'status':&nbsp;'401'},&nbsp;''),<br>
&nbsp;&nbsp;&nbsp;&nbsp;({'status':&nbsp;'200'},&nbsp;'{"access_token":"1/3w","expires_in":3600}'),<br>
&nbsp;&nbsp;&nbsp;&nbsp;({'status':&nbsp;'200'},&nbsp;'echo_request_headers'),<br>
&nbsp;&nbsp;&nbsp;&nbsp;])<br>
&nbsp;&nbsp;resp,&nbsp;content&nbsp;=&nbsp;http.<a href="#HttpMockSequence-request">request</a>("<a href="http://examples.com">http://examples.com</a>")<br>
&nbsp;<br>
There&nbsp;are&nbsp;special&nbsp;values&nbsp;you&nbsp;can&nbsp;pass&nbsp;in&nbsp;for&nbsp;content&nbsp;to&nbsp;trigger<br>
behavours&nbsp;that&nbsp;are&nbsp;helpful&nbsp;in&nbsp;testing.<br>
&nbsp;<br>
'echo_request_headers'&nbsp;means&nbsp;return&nbsp;the&nbsp;request&nbsp;headers&nbsp;in&nbsp;the&nbsp;response&nbsp;body<br>
'echo_request_headers_as_json'&nbsp;means&nbsp;return&nbsp;the&nbsp;request&nbsp;headers&nbsp;in<br>
&nbsp;&nbsp;&nbsp;the&nbsp;response&nbsp;body<br>
'echo_request_body'&nbsp;means&nbsp;return&nbsp;the&nbsp;request&nbsp;body&nbsp;in&nbsp;the&nbsp;response&nbsp;body<br>
'echo_request_uri'&nbsp;means&nbsp;return&nbsp;the&nbsp;request&nbsp;uri&nbsp;in&nbsp;the&nbsp;response&nbsp;body<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="HttpMockSequence-__init__"><strong>__init__</strong></a>(self, iterable)</dt><dd><tt>Args:<br>
&nbsp;&nbsp;iterable:&nbsp;iterable,&nbsp;a&nbsp;sequence&nbsp;of&nbsp;pairs&nbsp;of&nbsp;(headers,&nbsp;body)</tt></dd></dl>

<dl><dt><a name="HttpMockSequence-request"><strong>request</strong></a>(self, uri, method<font color="#909090">='GET'</font>, body<font color="#909090">=None</font>, headers<font color="#909090">=None</font>, redirections<font color="#909090">=1</font>, connection_type<font color="#909090">=None</font>)</dt></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="HttpRequest">class <strong>HttpRequest</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Encapsulates&nbsp;a&nbsp;single&nbsp;HTTP&nbsp;request.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="HttpRequest-__init__"><strong>__init__</strong></a>(self, http, postproc, uri, method<font color="#909090">='GET'</font>, body<font color="#909090">=None</font>, headers<font color="#909090">=None</font>, methodId<font color="#909090">=None</font>, resumable<font color="#909090">=None</font>)</dt><dd><tt>Constructor&nbsp;for&nbsp;an&nbsp;<a href="#HttpRequest">HttpRequest</a>.<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;http:&nbsp;httplib2.Http,&nbsp;the&nbsp;transport&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;to&nbsp;use&nbsp;to&nbsp;make&nbsp;a&nbsp;request<br>
&nbsp;&nbsp;postproc:&nbsp;callable,&nbsp;called&nbsp;on&nbsp;the&nbsp;HTTP&nbsp;response&nbsp;and&nbsp;content&nbsp;to&nbsp;transform<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;it&nbsp;into&nbsp;a&nbsp;data&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;before&nbsp;returning,&nbsp;or&nbsp;raising&nbsp;an&nbsp;exception<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;on&nbsp;an&nbsp;error.<br>
&nbsp;&nbsp;uri:&nbsp;string,&nbsp;the&nbsp;absolute&nbsp;URI&nbsp;to&nbsp;send&nbsp;the&nbsp;request&nbsp;to<br>
&nbsp;&nbsp;method:&nbsp;string,&nbsp;the&nbsp;HTTP&nbsp;method&nbsp;to&nbsp;use<br>
&nbsp;&nbsp;body:&nbsp;string,&nbsp;the&nbsp;request&nbsp;body&nbsp;of&nbsp;the&nbsp;HTTP&nbsp;request,<br>
&nbsp;&nbsp;headers:&nbsp;dict,&nbsp;the&nbsp;HTTP&nbsp;request&nbsp;headers<br>
&nbsp;&nbsp;methodId:&nbsp;string,&nbsp;a&nbsp;unique&nbsp;identifier&nbsp;for&nbsp;the&nbsp;API&nbsp;method&nbsp;being&nbsp;called.<br>
&nbsp;&nbsp;resumable:&nbsp;<a href="#MediaUpload">MediaUpload</a>,&nbsp;None&nbsp;if&nbsp;this&nbsp;is&nbsp;not&nbsp;a&nbsp;resumbale&nbsp;request.</tt></dd></dl>

<dl><dt><a name="HttpRequest-execute"><strong>execute</strong></a>(self, http<font color="#909090">=None</font>)</dt><dd><tt>Execute&nbsp;the&nbsp;request.<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;http:&nbsp;httplib2.Http,&nbsp;an&nbsp;http&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;to&nbsp;be&nbsp;used&nbsp;in&nbsp;place&nbsp;of&nbsp;the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;one&nbsp;the&nbsp;<a href="#HttpRequest">HttpRequest</a>&nbsp;request&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;was&nbsp;constructed&nbsp;with.<br>
&nbsp;<br>
Returns:<br>
&nbsp;&nbsp;A&nbsp;deserialized&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;model&nbsp;of&nbsp;the&nbsp;response&nbsp;body&nbsp;as&nbsp;determined<br>
&nbsp;&nbsp;by&nbsp;the&nbsp;postproc.<br>
&nbsp;<br>
Raises:<br>
&nbsp;&nbsp;apiclient.errors.HttpError&nbsp;if&nbsp;the&nbsp;response&nbsp;was&nbsp;not&nbsp;a&nbsp;2xx.<br>
&nbsp;&nbsp;httplib2.Error&nbsp;if&nbsp;a&nbsp;transport&nbsp;error&nbsp;has&nbsp;occured.</tt></dd></dl>

<dl><dt><a name="HttpRequest-next_chunk"><strong>next_chunk</strong></a>(self, http<font color="#909090">=None</font>)</dt><dd><tt>Execute&nbsp;the&nbsp;next&nbsp;step&nbsp;of&nbsp;a&nbsp;resumable&nbsp;upload.<br>
&nbsp;<br>
Can&nbsp;only&nbsp;be&nbsp;used&nbsp;if&nbsp;the&nbsp;method&nbsp;being&nbsp;executed&nbsp;supports&nbsp;media&nbsp;uploads&nbsp;and<br>
the&nbsp;<a href="#MediaUpload">MediaUpload</a>&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;passed&nbsp;in&nbsp;was&nbsp;flagged&nbsp;as&nbsp;using&nbsp;resumable&nbsp;upload.<br>
&nbsp;<br>
Example:<br>
&nbsp;<br>
&nbsp;&nbsp;media&nbsp;=&nbsp;<a href="#MediaFileUpload">MediaFileUpload</a>('smiley.png',&nbsp;mimetype='image/png',<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;chunksize=1000,&nbsp;resumable=True)<br>
&nbsp;&nbsp;request&nbsp;=&nbsp;service.objects().insert(<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bucket=buckets['items'][0]['id'],<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name='smiley.png',<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;media_body=media)<br>
&nbsp;<br>
&nbsp;&nbsp;response&nbsp;=&nbsp;None<br>
&nbsp;&nbsp;while&nbsp;response&nbsp;is&nbsp;None:<br>
&nbsp;&nbsp;&nbsp;&nbsp;status,&nbsp;response&nbsp;=&nbsp;request.<a href="#HttpRequest-next_chunk">next_chunk</a>()<br>
&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;status:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;"Upload&nbsp;%d%%&nbsp;complete."&nbsp;%&nbsp;int(status.progress()&nbsp;*&nbsp;100)<br>
&nbsp;<br>
&nbsp;<br>
Returns:<br>
&nbsp;&nbsp;(status,&nbsp;body):&nbsp;(ResumableMediaStatus,&nbsp;<a href="__builtin__.html#object">object</a>)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;body&nbsp;will&nbsp;be&nbsp;None&nbsp;until&nbsp;the&nbsp;resumable&nbsp;media&nbsp;is&nbsp;fully&nbsp;uploaded.</tt></dd></dl>

<dl><dt><a name="HttpRequest-to_json"><strong>to_json</strong></a>(self)</dt><dd><tt>Returns&nbsp;a&nbsp;JSON&nbsp;representation&nbsp;of&nbsp;the&nbsp;<a href="#HttpRequest">HttpRequest</a>.</tt></dd></dl>

<hr>
Static methods defined here:<br>
<dl><dt><a name="HttpRequest-from_json"><strong>from_json</strong></a>(s, http, postproc)</dt><dd><tt>Returns&nbsp;an&nbsp;<a href="#HttpRequest">HttpRequest</a>&nbsp;populated&nbsp;with&nbsp;info&nbsp;from&nbsp;a&nbsp;JSON&nbsp;<a href="__builtin__.html#object">object</a>.</tt></dd></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="HttpRequestMock">class <strong>HttpRequestMock</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Mock&nbsp;of&nbsp;<a href="#HttpRequest">HttpRequest</a>.<br>
&nbsp;<br>
Do&nbsp;not&nbsp;construct&nbsp;directly,&nbsp;instead&nbsp;use&nbsp;<a href="#RequestMockBuilder">RequestMockBuilder</a>.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="HttpRequestMock-__init__"><strong>__init__</strong></a>(self, resp, content, postproc)</dt><dd><tt>Constructor&nbsp;for&nbsp;<a href="#HttpRequestMock">HttpRequestMock</a><br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;resp:&nbsp;httplib2.Response,&nbsp;the&nbsp;response&nbsp;to&nbsp;emulate&nbsp;coming&nbsp;from&nbsp;the&nbsp;request<br>
&nbsp;&nbsp;content:&nbsp;string,&nbsp;the&nbsp;response&nbsp;body<br>
&nbsp;&nbsp;postproc:&nbsp;callable,&nbsp;the&nbsp;post&nbsp;processing&nbsp;function&nbsp;usually&nbsp;supplied&nbsp;by<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;model&nbsp;class.&nbsp;See&nbsp;model.JsonModel.response()&nbsp;as&nbsp;an&nbsp;example.</tt></dd></dl>

<dl><dt><a name="HttpRequestMock-execute"><strong>execute</strong></a>(self, http<font color="#909090">=None</font>)</dt><dd><tt>Execute&nbsp;the&nbsp;request.<br>
&nbsp;<br>
Same&nbsp;behavior&nbsp;as&nbsp;<a href="#HttpRequest">HttpRequest</a>.<a href="#HttpRequestMock-execute">execute</a>(),&nbsp;but&nbsp;the&nbsp;response&nbsp;is<br>
mocked&nbsp;and&nbsp;not&nbsp;really&nbsp;from&nbsp;an&nbsp;HTTP&nbsp;request/response.</tt></dd></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="MediaFileUpload">class <strong>MediaFileUpload</strong></a>(<a href="apiclient.http.html#MediaUpload">MediaUpload</a>)</font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>A&nbsp;<a href="#MediaUpload">MediaUpload</a>&nbsp;for&nbsp;a&nbsp;file.<br>
&nbsp;<br>
Construct&nbsp;a&nbsp;<a href="#MediaFileUpload">MediaFileUpload</a>&nbsp;and&nbsp;pass&nbsp;as&nbsp;the&nbsp;media_body&nbsp;parameter&nbsp;of&nbsp;the<br>
method.&nbsp;For&nbsp;example,&nbsp;if&nbsp;we&nbsp;had&nbsp;a&nbsp;service&nbsp;that&nbsp;allowed&nbsp;uploading&nbsp;images:<br>
&nbsp;<br>
&nbsp;<br>
&nbsp;&nbsp;media&nbsp;=&nbsp;<a href="#MediaFileUpload">MediaFileUpload</a>('smiley.png',&nbsp;mimetype='image/png',&nbsp;chunksize=1000,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;resumable=True)<br>
&nbsp;&nbsp;service.objects().insert(<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bucket=buckets['items'][0]['id'],<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name='smiley.png',<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;media_body=media).execute()<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="apiclient.http.html#MediaFileUpload">MediaFileUpload</a></dd>
<dd><a href="apiclient.http.html#MediaUpload">MediaUpload</a></dd>
<dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
</dl>
<hr>
Methods defined here:<br>
<dl><dt><a name="MediaFileUpload-__init__"><strong>__init__</strong></a>(self, filename, mimetype<font color="#909090">=None</font>, chunksize<font color="#909090">=262144</font>, resumable<font color="#909090">=False</font>)</dt><dd><tt>Constructor.<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;filename:&nbsp;string,&nbsp;Name&nbsp;of&nbsp;the&nbsp;file.<br>
&nbsp;&nbsp;mimetype:&nbsp;string,&nbsp;Mime-type&nbsp;of&nbsp;the&nbsp;file.&nbsp;If&nbsp;None&nbsp;then&nbsp;a&nbsp;mime-type&nbsp;will&nbsp;be<br>
&nbsp;&nbsp;&nbsp;&nbsp;guessed&nbsp;from&nbsp;the&nbsp;file&nbsp;extension.<br>
&nbsp;&nbsp;chunksize:&nbsp;int,&nbsp;File&nbsp;will&nbsp;be&nbsp;uploaded&nbsp;in&nbsp;chunks&nbsp;of&nbsp;this&nbsp;many&nbsp;bytes.&nbsp;Only<br>
&nbsp;&nbsp;&nbsp;&nbsp;used&nbsp;if&nbsp;resumable=True.<br>
&nbsp;&nbsp;resumable:&nbsp;bool,&nbsp;True&nbsp;if&nbsp;this&nbsp;is&nbsp;a&nbsp;resumable&nbsp;upload.&nbsp;False&nbsp;means&nbsp;upload<br>
&nbsp;&nbsp;&nbsp;&nbsp;in&nbsp;a&nbsp;single&nbsp;request.</tt></dd></dl>

<dl><dt><a name="MediaFileUpload-chunksize"><strong>chunksize</strong></a>(self)</dt></dl>

<dl><dt><a name="MediaFileUpload-getbytes"><strong>getbytes</strong></a>(self, begin, length)</dt><dd><tt>Get&nbsp;bytes&nbsp;from&nbsp;the&nbsp;media.<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;begin:&nbsp;int,&nbsp;offset&nbsp;from&nbsp;beginning&nbsp;of&nbsp;file.<br>
&nbsp;&nbsp;length:&nbsp;int,&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read,&nbsp;starting&nbsp;at&nbsp;begin.<br>
&nbsp;<br>
Returns:<br>
&nbsp;&nbsp;A&nbsp;string&nbsp;of&nbsp;bytes&nbsp;read.&nbsp;May&nbsp;be&nbsp;shorted&nbsp;than&nbsp;length&nbsp;if&nbsp;EOF&nbsp;was&nbsp;reached<br>
&nbsp;&nbsp;first.</tt></dd></dl>

<dl><dt><a name="MediaFileUpload-mimetype"><strong>mimetype</strong></a>(self)</dt></dl>

<dl><dt><a name="MediaFileUpload-resumable"><strong>resumable</strong></a>(self)</dt></dl>

<dl><dt><a name="MediaFileUpload-size"><strong>size</strong></a>(self)</dt></dl>

<dl><dt><a name="MediaFileUpload-to_json"><strong>to_json</strong></a>(self)</dt><dd><tt>Creating&nbsp;a&nbsp;JSON&nbsp;representation&nbsp;of&nbsp;an&nbsp;instance&nbsp;of&nbsp;Credentials.<br>
&nbsp;<br>
Returns:<br>
&nbsp;&nbsp;&nbsp;string,&nbsp;a&nbsp;JSON&nbsp;representation&nbsp;of&nbsp;this&nbsp;instance,&nbsp;suitable&nbsp;to&nbsp;pass&nbsp;to<br>
&nbsp;&nbsp;&nbsp;<a href="#MediaFileUpload-from_json">from_json</a>().</tt></dd></dl>

<hr>
Static methods defined here:<br>
<dl><dt><a name="MediaFileUpload-from_json"><strong>from_json</strong></a>(s)</dt></dl>

<hr>
Class methods inherited from <a href="apiclient.http.html#MediaUpload">MediaUpload</a>:<br>
<dl><dt><a name="MediaFileUpload-new_from_json"><strong>new_from_json</strong></a>(cls, s)<font color="#909090"><font face="helvetica, arial"> from <a href="__builtin__.html#type">__builtin__.type</a></font></font></dt><dd><tt>Utility&nbsp;class&nbsp;method&nbsp;to&nbsp;instantiate&nbsp;a&nbsp;<a href="#MediaUpload">MediaUpload</a>&nbsp;subclass&nbsp;from&nbsp;a&nbsp;JSON<br>
representation&nbsp;produced&nbsp;by&nbsp;<a href="#MediaFileUpload-to_json">to_json</a>().<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;s:&nbsp;string,&nbsp;JSON&nbsp;from&nbsp;<a href="#MediaFileUpload-to_json">to_json</a>().<br>
&nbsp;<br>
Returns:<br>
&nbsp;&nbsp;An&nbsp;instance&nbsp;of&nbsp;the&nbsp;subclass&nbsp;of&nbsp;<a href="#MediaUpload">MediaUpload</a>&nbsp;that&nbsp;was&nbsp;serialized&nbsp;with<br>
&nbsp;&nbsp;<a href="#MediaFileUpload-to_json">to_json</a>().</tt></dd></dl>

<hr>
Data descriptors inherited from <a href="apiclient.http.html#MediaUpload">MediaUpload</a>:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="MediaInMemoryUpload">class <strong>MediaInMemoryUpload</strong></a>(<a href="apiclient.http.html#MediaUpload">MediaUpload</a>)</font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt><a href="#MediaUpload">MediaUpload</a>&nbsp;for&nbsp;a&nbsp;chunk&nbsp;of&nbsp;bytes.<br>
&nbsp;<br>
Construct&nbsp;a&nbsp;<a href="#MediaFileUpload">MediaFileUpload</a>&nbsp;and&nbsp;pass&nbsp;as&nbsp;the&nbsp;media_body&nbsp;parameter&nbsp;of&nbsp;the<br>
method.&nbsp;For&nbsp;example,&nbsp;if&nbsp;we&nbsp;had&nbsp;a&nbsp;service&nbsp;that&nbsp;allowed&nbsp;plain&nbsp;text:<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="apiclient.http.html#MediaInMemoryUpload">MediaInMemoryUpload</a></dd>
<dd><a href="apiclient.http.html#MediaUpload">MediaUpload</a></dd>
<dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
</dl>
<hr>
Methods defined here:<br>
<dl><dt><a name="MediaInMemoryUpload-__init__"><strong>__init__</strong></a>(self, body, mimetype<font color="#909090">='application/octet-stream'</font>, chunksize<font color="#909090">=262144</font>, resumable<font color="#909090">=False</font>)</dt><dd><tt>Create&nbsp;a&nbsp;new&nbsp;MediaBytesUpload.<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;body:&nbsp;string,&nbsp;Bytes&nbsp;of&nbsp;body&nbsp;content.<br>
&nbsp;&nbsp;mimetype:&nbsp;string,&nbsp;Mime-type&nbsp;of&nbsp;the&nbsp;file&nbsp;or&nbsp;default&nbsp;of<br>
&nbsp;&nbsp;&nbsp;&nbsp;'application/octet-stream'.<br>
&nbsp;&nbsp;chunksize:&nbsp;int,&nbsp;File&nbsp;will&nbsp;be&nbsp;uploaded&nbsp;in&nbsp;chunks&nbsp;of&nbsp;this&nbsp;many&nbsp;bytes.&nbsp;Only<br>
&nbsp;&nbsp;&nbsp;&nbsp;used&nbsp;if&nbsp;resumable=True.<br>
&nbsp;&nbsp;resumable:&nbsp;bool,&nbsp;True&nbsp;if&nbsp;this&nbsp;is&nbsp;a&nbsp;resumable&nbsp;upload.&nbsp;False&nbsp;means&nbsp;upload<br>
&nbsp;&nbsp;&nbsp;&nbsp;in&nbsp;a&nbsp;single&nbsp;request.</tt></dd></dl>

<dl><dt><a name="MediaInMemoryUpload-chunksize"><strong>chunksize</strong></a>(self)</dt><dd><tt>Chunk&nbsp;size&nbsp;for&nbsp;resumable&nbsp;uploads.<br>
&nbsp;<br>
Returns:<br>
&nbsp;&nbsp;Chunk&nbsp;size&nbsp;in&nbsp;bytes.</tt></dd></dl>

<dl><dt><a name="MediaInMemoryUpload-getbytes"><strong>getbytes</strong></a>(self, begin, length)</dt><dd><tt>Get&nbsp;bytes&nbsp;from&nbsp;the&nbsp;media.<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;begin:&nbsp;int,&nbsp;offset&nbsp;from&nbsp;beginning&nbsp;of&nbsp;file.<br>
&nbsp;&nbsp;length:&nbsp;int,&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read,&nbsp;starting&nbsp;at&nbsp;begin.<br>
&nbsp;<br>
Returns:<br>
&nbsp;&nbsp;A&nbsp;string&nbsp;of&nbsp;bytes&nbsp;read.&nbsp;May&nbsp;be&nbsp;shorter&nbsp;than&nbsp;length&nbsp;if&nbsp;EOF&nbsp;was&nbsp;reached<br>
&nbsp;&nbsp;first.</tt></dd></dl>

<dl><dt><a name="MediaInMemoryUpload-mimetype"><strong>mimetype</strong></a>(self)</dt><dd><tt>Mime&nbsp;type&nbsp;of&nbsp;the&nbsp;body.<br>
&nbsp;<br>
Returns:<br>
&nbsp;&nbsp;Mime&nbsp;type.</tt></dd></dl>

<dl><dt><a name="MediaInMemoryUpload-resumable"><strong>resumable</strong></a>(self)</dt><dd><tt>Whether&nbsp;this&nbsp;upload&nbsp;is&nbsp;resumable.<br>
&nbsp;<br>
Returns:<br>
&nbsp;&nbsp;True&nbsp;if&nbsp;resumable&nbsp;upload&nbsp;or&nbsp;False.</tt></dd></dl>

<dl><dt><a name="MediaInMemoryUpload-size"><strong>size</strong></a>(self)</dt><dd><tt>Size&nbsp;of&nbsp;upload.<br>
&nbsp;<br>
Returns:<br>
&nbsp;&nbsp;Size&nbsp;of&nbsp;the&nbsp;body.</tt></dd></dl>

<dl><dt><a name="MediaInMemoryUpload-to_json"><strong>to_json</strong></a>(self)</dt><dd><tt>Create&nbsp;a&nbsp;JSON&nbsp;representation&nbsp;of&nbsp;a&nbsp;<a href="#MediaInMemoryUpload">MediaInMemoryUpload</a>.<br>
&nbsp;<br>
Returns:<br>
&nbsp;&nbsp;&nbsp;string,&nbsp;a&nbsp;JSON&nbsp;representation&nbsp;of&nbsp;this&nbsp;instance,&nbsp;suitable&nbsp;to&nbsp;pass&nbsp;to<br>
&nbsp;&nbsp;&nbsp;<a href="#MediaInMemoryUpload-from_json">from_json</a>().</tt></dd></dl>

<hr>
Static methods defined here:<br>
<dl><dt><a name="MediaInMemoryUpload-from_json"><strong>from_json</strong></a>(s)</dt></dl>

<hr>
Class methods inherited from <a href="apiclient.http.html#MediaUpload">MediaUpload</a>:<br>
<dl><dt><a name="MediaInMemoryUpload-new_from_json"><strong>new_from_json</strong></a>(cls, s)<font color="#909090"><font face="helvetica, arial"> from <a href="__builtin__.html#type">__builtin__.type</a></font></font></dt><dd><tt>Utility&nbsp;class&nbsp;method&nbsp;to&nbsp;instantiate&nbsp;a&nbsp;<a href="#MediaUpload">MediaUpload</a>&nbsp;subclass&nbsp;from&nbsp;a&nbsp;JSON<br>
representation&nbsp;produced&nbsp;by&nbsp;<a href="#MediaInMemoryUpload-to_json">to_json</a>().<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;s:&nbsp;string,&nbsp;JSON&nbsp;from&nbsp;<a href="#MediaInMemoryUpload-to_json">to_json</a>().<br>
&nbsp;<br>
Returns:<br>
&nbsp;&nbsp;An&nbsp;instance&nbsp;of&nbsp;the&nbsp;subclass&nbsp;of&nbsp;<a href="#MediaUpload">MediaUpload</a>&nbsp;that&nbsp;was&nbsp;serialized&nbsp;with<br>
&nbsp;&nbsp;<a href="#MediaInMemoryUpload-to_json">to_json</a>().</tt></dd></dl>

<hr>
Data descriptors inherited from <a href="apiclient.http.html#MediaUpload">MediaUpload</a>:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="MediaUpload">class <strong>MediaUpload</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Describes&nbsp;a&nbsp;media&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;to&nbsp;upload.<br>
&nbsp;<br>
Base&nbsp;class&nbsp;that&nbsp;defines&nbsp;the&nbsp;interface&nbsp;of&nbsp;<a href="#MediaUpload">MediaUpload</a>&nbsp;subclasses.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="MediaUpload-chunksize"><strong>chunksize</strong></a>(self)</dt></dl>

<dl><dt><a name="MediaUpload-getbytes"><strong>getbytes</strong></a>(self, begin, end)</dt></dl>

<dl><dt><a name="MediaUpload-mimetype"><strong>mimetype</strong></a>(self)</dt></dl>

<dl><dt><a name="MediaUpload-resumable"><strong>resumable</strong></a>(self)</dt></dl>

<dl><dt><a name="MediaUpload-size"><strong>size</strong></a>(self)</dt></dl>

<dl><dt><a name="MediaUpload-to_json"><strong>to_json</strong></a>(self)</dt><dd><tt>Create&nbsp;a&nbsp;JSON&nbsp;representation&nbsp;of&nbsp;an&nbsp;instance&nbsp;of&nbsp;<a href="#MediaUpload">MediaUpload</a>.<br>
&nbsp;<br>
Returns:<br>
&nbsp;&nbsp;&nbsp;string,&nbsp;a&nbsp;JSON&nbsp;representation&nbsp;of&nbsp;this&nbsp;instance,&nbsp;suitable&nbsp;to&nbsp;pass&nbsp;to<br>
&nbsp;&nbsp;&nbsp;from_json().</tt></dd></dl>

<hr>
Class methods defined here:<br>
<dl><dt><a name="MediaUpload-new_from_json"><strong>new_from_json</strong></a>(cls, s)<font color="#909090"><font face="helvetica, arial"> from <a href="__builtin__.html#type">__builtin__.type</a></font></font></dt><dd><tt>Utility&nbsp;class&nbsp;method&nbsp;to&nbsp;instantiate&nbsp;a&nbsp;<a href="#MediaUpload">MediaUpload</a>&nbsp;subclass&nbsp;from&nbsp;a&nbsp;JSON<br>
representation&nbsp;produced&nbsp;by&nbsp;<a href="#MediaUpload-to_json">to_json</a>().<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;s:&nbsp;string,&nbsp;JSON&nbsp;from&nbsp;<a href="#MediaUpload-to_json">to_json</a>().<br>
&nbsp;<br>
Returns:<br>
&nbsp;&nbsp;An&nbsp;instance&nbsp;of&nbsp;the&nbsp;subclass&nbsp;of&nbsp;<a href="#MediaUpload">MediaUpload</a>&nbsp;that&nbsp;was&nbsp;serialized&nbsp;with<br>
&nbsp;&nbsp;<a href="#MediaUpload-to_json">to_json</a>().</tt></dd></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="MediaUploadProgress">class <strong>MediaUploadProgress</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Status&nbsp;of&nbsp;a&nbsp;resumable&nbsp;upload.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="MediaUploadProgress-__init__"><strong>__init__</strong></a>(self, resumable_progress, total_size)</dt><dd><tt>Constructor.<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;resumable_progress:&nbsp;int,&nbsp;bytes&nbsp;sent&nbsp;so&nbsp;far.<br>
&nbsp;&nbsp;total_size:&nbsp;int,&nbsp;total&nbsp;bytes&nbsp;in&nbsp;complete&nbsp;upload.</tt></dd></dl>

<dl><dt><a name="MediaUploadProgress-progress"><strong>progress</strong></a>(self)</dt><dd><tt>Percent&nbsp;of&nbsp;upload&nbsp;completed,&nbsp;as&nbsp;a&nbsp;float.</tt></dd></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="RequestMockBuilder">class <strong>RequestMockBuilder</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>A&nbsp;simple&nbsp;mock&nbsp;of&nbsp;<a href="#HttpRequest">HttpRequest</a><br>
&nbsp;<br>
Pass&nbsp;in&nbsp;a&nbsp;dictionary&nbsp;to&nbsp;the&nbsp;constructor&nbsp;that&nbsp;maps&nbsp;request&nbsp;methodIds&nbsp;to<br>
tuples&nbsp;of&nbsp;(httplib2.Response,&nbsp;content,&nbsp;opt_expected_body)&nbsp;that&nbsp;should&nbsp;be<br>
returned&nbsp;when&nbsp;that&nbsp;method&nbsp;is&nbsp;called.&nbsp;None&nbsp;may&nbsp;also&nbsp;be&nbsp;passed&nbsp;in&nbsp;for&nbsp;the<br>
httplib2.Response,&nbsp;in&nbsp;which&nbsp;case&nbsp;a&nbsp;200&nbsp;OK&nbsp;response&nbsp;will&nbsp;be&nbsp;generated.<br>
If&nbsp;an&nbsp;opt_expected_body&nbsp;(str&nbsp;or&nbsp;dict)&nbsp;is&nbsp;provided,&nbsp;it&nbsp;will&nbsp;be&nbsp;compared&nbsp;to<br>
the&nbsp;body&nbsp;and&nbsp;UnexpectedBodyError&nbsp;will&nbsp;be&nbsp;raised&nbsp;on&nbsp;inequality.<br>
&nbsp;<br>
Example:<br>
&nbsp;&nbsp;response&nbsp;=&nbsp;'{"data":&nbsp;{"id":&nbsp;"tag:google.c...'<br>
&nbsp;&nbsp;requestBuilder&nbsp;=&nbsp;<a href="#RequestMockBuilder">RequestMockBuilder</a>(<br>
&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'plus.activities.get':&nbsp;(None,&nbsp;response),<br>
&nbsp;&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;)<br>
&nbsp;&nbsp;apiclient.discovery.build("plus",&nbsp;"v1",&nbsp;requestBuilder=requestBuilder)<br>
&nbsp;<br>
Methods&nbsp;that&nbsp;you&nbsp;do&nbsp;not&nbsp;supply&nbsp;a&nbsp;response&nbsp;for&nbsp;will&nbsp;return&nbsp;a<br>
200&nbsp;OK&nbsp;with&nbsp;an&nbsp;empty&nbsp;string&nbsp;as&nbsp;the&nbsp;response&nbsp;content&nbsp;or&nbsp;raise&nbsp;an&nbsp;excpetion<br>
if&nbsp;check_unexpected&nbsp;is&nbsp;set&nbsp;to&nbsp;True.&nbsp;The&nbsp;methodId&nbsp;is&nbsp;taken&nbsp;from&nbsp;the&nbsp;rpcName<br>
in&nbsp;the&nbsp;discovery&nbsp;document.<br>
&nbsp;<br>
For&nbsp;more&nbsp;details&nbsp;see&nbsp;the&nbsp;project&nbsp;wiki.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="RequestMockBuilder-__call__"><strong>__call__</strong></a>(self, http, postproc, uri, method<font color="#909090">='GET'</font>, body<font color="#909090">=None</font>, headers<font color="#909090">=None</font>, methodId<font color="#909090">=None</font>, resumable<font color="#909090">=None</font>)</dt><dd><tt>Implements&nbsp;the&nbsp;callable&nbsp;interface&nbsp;that&nbsp;discovery.build()&nbsp;expects<br>
of&nbsp;requestBuilder,&nbsp;which&nbsp;is&nbsp;to&nbsp;build&nbsp;an&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;compatible&nbsp;with<br>
<a href="#HttpRequest">HttpRequest</a>.execute().&nbsp;See&nbsp;that&nbsp;method&nbsp;for&nbsp;the&nbsp;description&nbsp;of&nbsp;the<br>
parameters&nbsp;and&nbsp;the&nbsp;expected&nbsp;response.</tt></dd></dl>

<dl><dt><a name="RequestMockBuilder-__init__"><strong>__init__</strong></a>(self, responses, check_unexpected<font color="#909090">=False</font>)</dt><dd><tt>Constructor&nbsp;for&nbsp;<a href="#RequestMockBuilder">RequestMockBuilder</a><br>
&nbsp;<br>
The&nbsp;constructed&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;should&nbsp;be&nbsp;a&nbsp;callable&nbsp;<a href="__builtin__.html#object">object</a><br>
that&nbsp;can&nbsp;replace&nbsp;the&nbsp;class&nbsp;HttpResponse.<br>
&nbsp;<br>
responses&nbsp;-&nbsp;A&nbsp;dictionary&nbsp;that&nbsp;maps&nbsp;methodIds&nbsp;into&nbsp;tuples<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;of&nbsp;(httplib2.Response,&nbsp;content).&nbsp;The&nbsp;methodId<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;comes&nbsp;from&nbsp;the&nbsp;'rpcName'&nbsp;field&nbsp;in&nbsp;the&nbsp;discovery<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.<br>
check_unexpected&nbsp;-&nbsp;A&nbsp;boolean&nbsp;setting&nbsp;whether&nbsp;or&nbsp;not&nbsp;UnexpectedMethodError<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;should&nbsp;be&nbsp;raised&nbsp;on&nbsp;unsupplied&nbsp;method.</tt></dd></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
    
<tr><td bgcolor="#eeaa77"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl><dt><a name="-set_user_agent"><strong>set_user_agent</strong></a>(http, user_agent)</dt><dd><tt>Set&nbsp;the&nbsp;user-agent&nbsp;on&nbsp;every&nbsp;request.<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;&nbsp;http&nbsp;-&nbsp;An&nbsp;instance&nbsp;of&nbsp;httplib2.Http<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or&nbsp;something&nbsp;that&nbsp;acts&nbsp;like&nbsp;it.<br>
&nbsp;&nbsp;&nbsp;user_agent:&nbsp;string,&nbsp;the&nbsp;value&nbsp;for&nbsp;the&nbsp;user-agent&nbsp;header.<br>
&nbsp;<br>
Returns:<br>
&nbsp;&nbsp;&nbsp;A&nbsp;modified&nbsp;instance&nbsp;of&nbsp;http&nbsp;that&nbsp;was&nbsp;passed&nbsp;in.<br>
&nbsp;<br>
Example:<br>
&nbsp;<br>
&nbsp;&nbsp;h&nbsp;=&nbsp;httplib2.Http()<br>
&nbsp;&nbsp;h&nbsp;=&nbsp;<a href="#-set_user_agent">set_user_agent</a>(h,&nbsp;"my-app-name/6.0")<br>
&nbsp;<br>
Most&nbsp;of&nbsp;the&nbsp;time&nbsp;the&nbsp;user-agent&nbsp;will&nbsp;be&nbsp;set&nbsp;doing&nbsp;auth,&nbsp;this&nbsp;is&nbsp;for&nbsp;the&nbsp;rare<br>
cases&nbsp;where&nbsp;you&nbsp;are&nbsp;accessing&nbsp;an&nbsp;unauthenticated&nbsp;endpoint.</tt></dd></dl>
 <dl><dt><a name="-tunnel_patch"><strong>tunnel_patch</strong></a>(http)</dt><dd><tt>Tunnel&nbsp;PATCH&nbsp;requests&nbsp;over&nbsp;POST.<br>
Args:<br>
&nbsp;&nbsp;&nbsp;http&nbsp;-&nbsp;An&nbsp;instance&nbsp;of&nbsp;httplib2.Http<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or&nbsp;something&nbsp;that&nbsp;acts&nbsp;like&nbsp;it.<br>
&nbsp;<br>
Returns:<br>
&nbsp;&nbsp;&nbsp;A&nbsp;modified&nbsp;instance&nbsp;of&nbsp;http&nbsp;that&nbsp;was&nbsp;passed&nbsp;in.<br>
&nbsp;<br>
Example:<br>
&nbsp;<br>
&nbsp;&nbsp;h&nbsp;=&nbsp;httplib2.Http()<br>
&nbsp;&nbsp;h&nbsp;=&nbsp;<a href="#-tunnel_patch">tunnel_patch</a>(h,&nbsp;"my-app-name/6.0")<br>
&nbsp;<br>
Useful&nbsp;if&nbsp;you&nbsp;are&nbsp;running&nbsp;on&nbsp;a&nbsp;platform&nbsp;that&nbsp;doesn't&nbsp;support&nbsp;PATCH.<br>
Apply&nbsp;this&nbsp;last&nbsp;if&nbsp;you&nbsp;are&nbsp;using&nbsp;OAuth&nbsp;1.0,&nbsp;as&nbsp;changing&nbsp;the&nbsp;method<br>
will&nbsp;result&nbsp;in&nbsp;a&nbsp;different&nbsp;signature.</tt></dd></dl>
</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
    
<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><strong>__author__</strong> = 'jcgregorio@google.com (Joe Gregorio)'</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#7799ee">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Author</strong></big></font></td></tr>
    
<tr><td bgcolor="#7799ee"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%">jcgregorio@google.com&nbsp;(Joe&nbsp;Gregorio)</td></tr></table>
</body></html>